package com.du.stutestsys.controller.TeacherManage;

import com.alibaba.fastjson.JSONObject;
import com.du.stutestsys.controller.BaseControler;
import com.du.stutestsys.entity.SysUser;
import com.du.stutestsys.service.Administrator.SysUserService;
import com.du.stutestsys.service.TeacherManage.TeacherService;
import com.du.stutestsys.util.DuUtil;
import com.du.stutestsys.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Controller
public class TeacherControler extends BaseControler {
    @Autowired
    TeacherService teacherService;
    @GetMapping("admin/selectStu")
    public String selectStu(@RequestBody SysUser sysUser){
        //如果对象为空则查询全部
        PageUtil pageUtil = DuUtil.setPageUtil(sysUser, 0, 10);
        List<SysUser> listUser = teacherService.selectStu(sysUser,pageUtil);
        JSONObject success = DuUtil.success(listUser.size() > 0, listUser, listUser+"",pageUtil);
        return success.toJSONString();
    }



}
